import Vue from 'vue'             /* 引入vue */
import VueRouter from 'vue-router'    /* 引入vue-router  第三方库需要use一下才能使用 */

/* 引入本项目所需界面 */
import Login from "../views/Login.vue"
import Home from "../views/Home.vue"

// 用户页面
import UploadInfo from "../components/user/UploadReceiveInfo.vue"

// 快递总部页面
import ExpressRoute from "../components/expressheadquarters/ExpressRoute.vue";     // 快递路线设置
import ExpressAddressQuery  from "../components/expressheadquarters/queryExpressAddress.vue";   // 快递发货地址和收货地址查询

// 快递站点页面
import ShowExpress from "../components/expresssites/QueryNextExpressNode.vue";

// 快递查询页面
import ExpressQuery from "../components/express/ExpressQuery.vue";

// 电商平台页面
import UploadOrderInfo from "../components/ecplatform/UploadOrderInfo.vue";

// 电商商家页面
import UploadSendInfo from "../components/ecbusiness/UploadSendInfo.vue"

Vue.use(VueRouter)  /*  */

const routes = [                      /*定义routes路由的集合，数组类型 */
    {
        path: '/',
        redirect: '/login'     /* 配置重定向 当匹配到路径为空的时候，就会重定向到page1 执行page1的路由 */
    }, {
        path: '/login',
        component: Login
    }, {
        path: '/home',
        component: Home,
        //component:() => import(.....) 路由懒加载
        redirect: '/expressroute',
        children: [
            // 用户端
            {path: '/uploadreceiveinfo', component: UploadInfo},

            // 快递总部端
            {path: '/expressroute', component: ExpressRoute},
            {path: '/expressaddressquery', component: ExpressAddressQuery},

            // 快递站点端
            {path: '/expressnext', component: ShowExpress},

            // 快递查询页面
            {path: '/expressquery', component: ExpressQuery},

            // 电商平台页面
            {path: '/uploadorderinfo', component: UploadOrderInfo},

            // 电商商家页面
            {path: '/uploadsendinfo', component: UploadSendInfo},


        ]
    },
];


/* 实例化VueRouter并将routes添加进去 */
const router = new VueRouter({
    routes
})

/* 抛出这个实例对象方便外部读取和访问 */
export default router
